<? if(!defined('IN_TIPASK')) exit('Access Denied'); include template('header'); ?>
<script src="../ckeditor/ckeditor.js" type="text/javascript"></script>
<div class="box">
    <div class="box_left">
        <div class="box_left_nav font_gray" style="font-size: 12px;">→  <a href="<?=SITE_URL?>"><?=$setting['site_name']?></a> &gt;&gt; 提问</div>
        <div class="box_left1 height790">
            <form name="askform" onsubmit="return check_askform(this);" action="<?=SITE_URL?>?question/add.html" method="post" >
                <div class="boxtop2_title boxtop1"><strong>提问</strong></div>
                <div class="box_left1_down">
                    <table class="tiwen_table" border="0" cellpadding="0" cellspacing="0" width="100%">
                        <tr valign="top">
                            <td align="left" valign="top" width="17%" nowrap="nowrap">
                                <b class="ttc">您的问题:</b></td>
                            <td id="td1" class="tdof" colspan="2">
                                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                    <tr>
                                        <td class="tiw_kuai" align="left" valign="top" width="320" height="25"><input style="width: 320px; height: 16px;" name="title" value="<?=$word?>" id="mytitle" class="f14"><span id="spMsg"></span></td>
                                        <td class="tiw_kuai" align="left" valign="top" width="180"></td>
                                    </tr>
                                    <tr>
                                        <td style="padding-right: 25px;" colspan="2" align="right"></td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="10" height="5"></td>
                        </tr>

<!-- ckeditor changes here-->


                        <tr valign="top">
                            <td align="left" width="17%" nowrap="nowrap">
                                <b class="ttc">问题补充:</b></td>
                            <td colspan="2">
                                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                    <tr>

                                        <td class="tiw_kuai" colspan="2">
<!--
<textarea id="mydescription" name="description" rows="10" cols="50">
helloworld
</textarea>
-->

<textarea class="ckeditor" id="mydescription" name="description" rows="1" cols="1">
点上面的∑符号可以编辑公式
</textarea>

<script type="text/javascript">
CKEDITOR.replace( 'mydescription' ); 
</script>

                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="left" valign="middle" height="30">
                                            <span class="font_gray">可输入4000字，问题说明越详细，回答也会越准确！参见</span>
                                            <span class="blue2"><a target="_blank" href="<?=SITE_URL?>?index/help.html">如何提问</a></span>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>





                        <tr>
                            <td colspan="10" height="100%"></td>
                        </tr>
                        <tr style id="xuanze" valign="top">
                            <td align="left" width="17%" nowrap="nowrap">
                                <b class="ttc">问题分类:</b></td>
                            <td id="td3" class="tdof" colspan="2">
                                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                    <tr valign="top">
                                        <td width="15%">
                                            <div class="tiwen2 tiw_kuai">
                                                <select  id="ClassLevel1" style="width: 125px; height: 165px;" size="8" name="classlevel1">
                                                    <option selected></option>
                                                </select>
                                            </div>
                                        </td>
                                        <td align="center" valign="middle" width="5%">
                                            <div><b>→</b></div>
                                        </td>
                                        <td width="17%">
                                            <div class="tiwen2">
                                                <select  id="ClassLevel2"  style="width: 125px; height: 165px;" size="8" name="classlevel2">
                                                    <option selected></option>
                                                </select>
                                            </div>
                                        </td>
                                        <td align="center" valign="middle" width="6%">
                                            <div style="display: none;" id="jiantou"><b>→</b></div>
                                        </td>
                                        <td width="1%"></td>
                                        <td width="19%">
                                            <select id="ClassLevel3"  style="width: 125px; height: 165px; display: none;" size="8" onchange="getCidValue();"  name="classlevel3">
                                                <option selected></option>
                                            </select>
                                        </td>
                                        <td width="32%"></td>
                                    </tr>
                                    <tr valign="top">
                                        <td class="tiw_biaozhu" colspan="5" align="left" valign="middle">请您选择正确的分类，以使您的问题尽快得到解答。</td>
                                    </tr>
                                </table>
                            </td>
                        </tr>


                        <tr>
                            <td colspan="10" height="20"></td>
                        </tr>
                        <tr valign="top">
                            <td align="left" width="17%" height="25">
                                <b class="ttc">悬赏分:</b></td>
                            <td colspan="2" height="25">
                                <table id="login3" border="0" cellpadding="0" cellspacing="0" width="100%" height="25">
                                    <tr>
                                        <td class="tiw_kuai" align="left" valign="top" width="50">
                                            <select name="givescore">
                                                <option selected="selected" value="0">0</option>
                                                <option value="5">5</option>
                                                <option value="10">10</option>
                                                <option value="15">15</option>
                                                <option value="20">20</option>
                                                <option value="30">30</option>
                                                <option value="50">50</option>
                                                <option value="80">80</option>
                                                <option value="100">100</option>
                                            </select>
                                        </td>
                                        <td align="left" valign="middle">
                                            <span class="margin20">您目前的财富值：<span class="wy_money"><? if($user['credit2']) { ?><?=$user['credit2']?><? } else { ?>0<? } ?></span></span>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr valign="top">
                            <td align="middle" width="17%" height="20" nowrap="nowrap"></td>
                            <td class="tiw_biaozhu" colspan="2" align="left" valign="middle" height="20">
                                <span class="font_gray">悬赏分越高，您的问题会越受关注，从而得到更佳答案。</span></td>
                        </tr><? if($user['uid']) { ?>                        <tr valign="top">
                            <td align="left" width="17%" height="25"></td>
                            <td  colspan="2" class="tiw_biaozhu" align="left" valign="middle" height="20"><input type="checkbox" name="hidanswer" value="1">您可以对问题设定匿名，但您需要付出财富值<span class="wy_money">10</span>分。</td>
                        </tr>
                        <? } ?>                        
                        <? if($setting['code_ask']) { ?>                        <tr valign="top">
                            <td align="left" width="17%" height="25"><b class="ttc">验证码:</b></td>
                            <td class="tiw_biaozhu" colspan="2" align="left" valign="middle" height="20">
<!-- delect captcha by laohyx   
                                    <input name="code" size="12"  tabindex="3" style="vertical-align: middle; width: 83px; text-transform: uppercase;" type="text">                                 <img  id="verifycode"   src="<?=SITE_URL?>?user/code.html">                                <span id="checkcode">

                                    <a href="javascript:updatecode();">看不清，换一张</a>
                                </span>
-->
                            </td>
                        </tr>
                        <? } ?>                        <tr valign="top">
                            <td colspan="3" align="center" valign="bottom" height="40">
                                <input type="hidden" value="0" name="cid" />
                                <input type="hidden" value="<?=$askfromuid?>" name="askfromuid" />
                                <input type="submit" name="submit" value="提交问题" class="btn_search" style="vertical-align: middle;" />
                            </td>
                        </tr>
                        <tr valign="top">
                            <td colspan="3" align="middle" height="20" nowrap="nowrap"></td>
                        </tr>
                    </table>
                </div>
            </form>
        </div>
        <div class="blank10" style="display: none;"></div>
    </div>

    <div class="boxthree">
        <div class="box_left_nav">
        </div>

        <div class="boxthree2 height800">
            <div class="boxtop">
                <div class="boxtop1_more" style="font-size: 12px; font-weight: normal;" id="linkMore"><a id="searchurl" href="javascript:void(0)" target="_blank">更多&gt;&gt;</a></div>
相关已解决问题
            </div>
            <div class="boxthree2down">
                <div class="bb_xjxg">
                    <div style="clear: both;">
                        <div class="login">
                            <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                <tr>
                                    <td colspan="3" height="50">
                                        <table id="searchresult" border="0" cellpadding="0" cellspacing="0" width="100%"></table>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="clear"></div>
</div><? if($setting['editor_on'] ) { ?><script src="<?=SITE_URL?>js/xheditor/xheditor-zh-cn.min.js" type="text/javascript"></script><? } ?><script type="text/javascript">



    
    var sortobj=eval('(<?=$category_js?>)');
    var g_ClassLevel1;
    var g_ClassLevel2;
    var g_ClassLevel3;
    var class_level_1=sortobj.category1;
    var class_level_2=sortobj.category2;
    var class_level_3=sortobj.category3;
    var button_noselect="不选择";

    function getCidValue()
    {
        var _cl1 = document.askform.ClassLevel1;
        var _cl2 = document.askform.ClassLevel2;
        var _cl3 = document.askform.ClassLevel3;
        var _cid = document.askform.cid;
        if(_cl1.value!=0) _cid.value = _cl1.value;
        if(_cl2.value!=0) _cid.value = _cl2.value;
        if(_cl3.value!=0) _cid.value = _cl3.value;
    }
    function FillClassLevel1(ClassLevel1)
    {
        ClassLevel1.options[0] = new Option("aa", "0");
        for(i=0; i<class_level_1.length; i++)
        {
            ClassLevel1.options[i] = new Option(class_level_1[i][1], class_level_1[i][0]);
        }
        // ClassLevel1.options[0].selected = true;
        ClassLevel1.length = i;
    }
    function FillClassLevel2(ClassLevel2, class_level_1_id)
    {
        ClassLevel2.options[0] = new Option(button_noselect, "");
        count = 1;
        for(i=0; i<class_level_2.length; i++){
            if(class_level_2[i][0].toString() == class_level_1_id) {
                ClassLevel2.options[count] = new Option(class_level_2[i][2], class_level_2[i][1]);
                count = count+1;}
        }
        ClassLevel2.options[0].selected = true;
        ClassLevel2.length = count;
    }
    function FillClassLevel3(ClassLevel3, class_level_2_id)
    {
        ClassLevel3.options[0] = new Option(button_noselect, "");
        count = 1;
        for(i=0; i<class_level_3.length; i++) {
            if(class_level_3[i][0].toString() == class_level_2_id) {
                ClassLevel3.options[count] = new Option(class_level_3[i][2], class_level_3[i][1]);
                count = count+1;}
        }
        ClassLevel3.options[0].selected = true;
        ClassLevel3.length = count;
    }
    function ClassLevel2_onchange()
    {
        getCidValue();
        FillClassLevel3(g_ClassLevel3, g_ClassLevel2.value);
        if (g_ClassLevel3.length <= 1) {
            g_ClassLevel3.style.display = "none";
            document.getElementById("jiantou").style.display = "none";
        }
        else {
            g_ClassLevel3.style.display = "";
            document.getElementById("jiantou").style.display = "";
        }
    }
 
    function ClassLevel1_onchange()
    {
        getCidValue();
        FillClassLevel2(g_ClassLevel2, g_ClassLevel1.value);
        ClassLevel2_onchange();

    }
    function InitClassLevelList(ClassLevel1, ClassLevel2, ClassLevel3)
    {
        g_ClassLevel1=ClassLevel1;
        g_ClassLevel2=ClassLevel2;
        g_ClassLevel3=ClassLevel3;
        g_ClassLevel1.onchange = Function("ClassLevel1_onchange();");
        g_ClassLevel2.onchange = Function("ClassLevel2_onchange();");
        FillClassLevel1(g_ClassLevel1);
        ClassLevel1_onchange();
    }
    InitClassLevelList(document.askform.ClassLevel1, document.askform.ClassLevel2, document.askform.ClassLevel3);

    var selected_id_list="0"
    var blank_pos = selected_id_list.indexOf(" ");
    var find_blank = true;
    if (blank_pos == -1) {
        find_blank = false;
        blank_pos = selected_id_list.length;
    }
    var id_str = selected_id_list.substr(0, blank_pos);
    g_ClassLevel1.value = id_str;
    ClassLevel1_onchange();

    if (find_blank == true) {
        selected_id_list = selected_id_list.substr(blank_pos + 1,   selected_id_list.length - blank_pos - 1);
        blank_pos = selected_id_list.indexOf(" ");
        if (blank_pos == -1) {
            find_blank = false;
            blank_pos = selected_id_list.length;
        }
        id_str = selected_id_list.substr(0, blank_pos);
        g_ClassLevel2.value = id_str;
        ClassLevel2_onchange();

        if (find_blank == true) {
            selected_id_list = selected_id_list.substr(blank_pos + 1,  selected_id_list.length - blank_pos - 1);
            blank_pos = selected_id_list.indexOf(" ");
            if (blank_pos == -1) {
                find_blank = false;
                blank_pos = selected_id_list.length;
            }
            id_str = selected_id_list.substr(0, blank_pos);
            g_ClassLevel3.value = id_str;
        }
    }

    /*检查*/
    function check_askform(obj){
        if (bytes(obj.title.value) < 8 ||  bytes(obj.title.value)>60) {
            alert("问题标题长度不得少于4个字，不能超过30字！");
            obj.title.focus();
            return false;
        }
        /*
        if(obj.description.value ==""){
                alert("问题描述不能为空!");
                obj.description.focus();
                return false;
        }*/
        if(obj.classlevel1.selectedIndex==-1){
            alert("没有选择分类!");
            return false;
        }
        <? if($user['uid']) { ?>        //检查财富值是否够用
        var offerscore=0;
        if(obj.hidanswer.checked)offerscore+=10;
        offerscore+=parseInt(obj.givescore.value);
        if(offerscore><?=$user['credit2']?>){
            alert("你的RP值不够!");
            return false;
        }
        <? } ?>    }
</script>
<? include template('footer'); ?>
